package d1118;

import java.util.*;
/*
姓名 学号 英语
唐凯悦 41926081 90 真住 41926084 78 41926022 91龙 41926010 87安典 41926038 91泽轩 41926006 92姚之涵 41926077 92
韩学敏 41926015 91母奉泽 41926020 92刘立奇 41926025 90张小艳 41926013 89徐奥 41926079 91
 */
/*
subset :按照特定格式传参数
 */
public class StuApps {
    static List<Student> list=new ArrayList<>();
    public static void main(String[] args) {
        init();


        System.out.println("学生们的平均分是："+Tools.getAvg(list));//平均分
        //System.out.println(Tools.getMax(list));//最高分
        //Tools.getBl60(list);//不及格
        Student stu1=new Student("唐凯悦","41926081",70);
        Student stu2=new Student("姚之涵","4192661",55);
        Student stu3=new Student("安典","4192671",95);
        Student stu4=new Student("张小艳","41926081",90);
        Student stu5=new Student("成龙","4192521",59);
        Student stu6=new Student("韩学敏","41926051",60);
        Student stu7=new Student("刘立奇","4195231",73);
        Student stu8=new Student("张小艳","419564561",69);
        TreeSet Students =new TreeSet<>(new Comparator<Student>(){
            @Override
            public int compare(Student o1, Student o2) {
                return Double.compare(o2.getMark(),o1.getMark());
            }
        });
        Students.add(stu1);
        Students.add(stu2);
        Students.add(stu3);
        Students.add(stu4);
        Students.add(stu5);
        Students.add(stu6);
        Students.add(stu7);
        Students.add(stu8);
        System.out.println("Student列表:"+Students);
        System.out.println("最小值是"+Students.last());//最低分
        System.out.println("最大值是:"+Students.first());//最高分
        System.out.println(Tools.getBl60(list,60));//小于多少分的有
        // SortedSet<Student> s= Students.subSet(new Student("唐凯悦","4566",55),new Student("张小艳","46465",60));


    }//作业：第五大题编程题 ---都得会    平均值 最大值 最小值
    public static void init() {
        Student stu1 = new Student("唐凯悦", "41926081", 70);
        Student stu2 = new Student("姚之涵", "4192661", 55);
        Student stu3 = new Student("安典", "4192671", 95);
        Student stu4 = new Student("张小艳", "41926081", 90);
        Student stu5 = new Student("成龙", "4192521", 59);
        Student stu6 = new Student("韩学敏", "41926051", 60);
        Student stu7 = new Student("刘立奇", "4195231", 73);
        Student stu8 = new Student("张小艳", "419564561", 69);
        TreeSet Students = new TreeSet<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return Double.compare(o2.getMark(), o1.getMark());
            }
        });
    }
}


